package com.szrt.mysql.demo11.procedure;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;

import org.junit.Test;

public class MoneyTest {
	
	
	@Test
	public void testName() throws Exception {
		Connection conn = null;
		CallableStatement cs=null;
		//1：加载驱动
		Class.forName("com.mysql.jdbc.Driver");
		
		//2：获取连接
		conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/szrt", "root", "root");
		
		//3：创建CallableStatement对象
		cs=conn.prepareCall("{call proc_update(?,?)}");
		
		//4：给参数赋值 注意下标从1开始
		cs.setInt(1,1);
		cs.setFloat(2, 0.11f);
		
		//5：执行sql
		cs.executeUpdate();
		
		//6:关闭资源
		cs.close();
		conn.close();
	}

}
